import re


def extract_json_code_blocks(markdown_text):
    """
    Extracts code blocks from Gemini markdown text.

    Args:
      markdown_text: The markdown text to extract from.

    Returns:
      A list of code blocks.
    """
    code_blocks = []
    # *? -> regular expression ending in ? is non-greedy match (match the shortest substring that satisfies the pattern)
    for match in re.findall(r"```json(.*?)```", markdown_text, re.DOTALL):
        # str.strip([chars]) -> Remove leading and trailing characters
        code_blocks.append(match.strip())  # Remove leading and trailing whitespace
    return code_blocks